<template>
  <button @click="handleClick" :style="styles" v-text="title">
  </button>
</template>

<script>
  export default {
    name: 'btn',
    props: {
      title: {
        type: String,
        default: '搜索'
      },
      color:{
        type: String,
        default: '#0094db'
      },
      width: {
        type: String,
        default: '95%'
      },
      height: {
        type: String,
        default: '1.33333rem'
      }
    },
    computed: {
      styles() {
        return {
          background: this.color,
          width: this.width,
          height: this.height,
          lineHeight: this.height
        }
      }
    },
    methods: {
      handleClick(e){
        //触发父组件的click事件
        this.$emit('clickMe', e)
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  button{
    margin: 0 auto;
    display: block;
    width: 94%;
    height: 1.333333rem;
    border-radius: 0.666667rem;
    line-height: 1.333333rem;
    text-align: center;
    color: #fff;
    font-size: .9rem;
    background-color: #0094db;
  }
</style>
